﻿using MediatR;
using Traceability.Commont.Domains.AnimalsDomainFiles;
using Traceability.Commont.DTOs.CommontFiles;
using Traceability.Commont.Infrastructures.Interfaces;

namespace U.Enterprise.Api.Applications.Scalesetting
{
    /// <summary>
    /// 获取磅秤类型
    /// </summary>
    public class ScaleTypeListHander : IRequestHandler<ScaleTypeListCommand, Resqults<ScaleType>>
    {
        private readonly IBateRepository<ScaleType> scale;

        public ScaleTypeListHander(IBateRepository<ScaleType> scale)
        {
            this.scale = scale;
        }

        public async Task<Resqults<ScaleType>> Handle(ScaleTypeListCommand request, CancellationToken cancellationToken)
        {
            try
            {
                Resqults<ScaleType> res = new Resqults<ScaleType>();
                res.Date= scale.GetAll().ToList();
                return res;
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
